package com.alan.server.exception;

import com.alan.server.enums.ServiceErrorCodeEnum;
import lombok.Getter;
import lombok.Setter;

public class ServiceException extends Exception {
	private static final long serialVersionUID = 1L;

	@Getter
	@Setter
	private String errorCode;
	/**
	 * 针对属性为空异常异常
	 */
	@Getter
	@Setter
	private String attribute; // 属性名称

	/**
	 * 针对属性为空异常异常
	 * 
	 * @param errorCode
	 * @param msg
	 * @param attribute
	 */
	public ServiceException(String errorCode, String msg, String attribute) {
		super(msg);
		this.errorCode = errorCode;
		this.attribute = attribute;

	}

	public ServiceException(String errorCode, String msg, Throwable cause) {
		super(msg, cause);
		this.errorCode = errorCode;

	}

	public ServiceException(String errorCode, String msg) {
		super(msg);
		this.errorCode = errorCode;
	}
	
	public ServiceException(ServiceErrorCodeEnum error) {
        super(error.getMsg());
        this.errorCode = error.getCode();
    }



}
